# coding=utf-8
for i in range(1,5):
    for j in range(1,5):
        if i == j:
            continue
        for k in range(1,5):
            if j == k or i == k:
                continue
            else:
                print i,j,k

for i in range(1, 5):
    for j in range(1, 5):
        for k in range(1, 5):
            # 如果i,j,k互不相等则输出到控制台
            if i != j and i != k and j != k:
                print(str(i)+str(j)+str(k))
